#define _CRT_SECURE_NO_WARNINGS 2

#include<iostream>
#include<stack>
using namespace std;

void Temperature(int* arr1, int* arr2, int n) {
	stack<int> s;
	s.push(0);
	int k = 1;
	while (k < n) {
		int top = s.top();
		if (arr1[k] <= arr1[top])
			s.push(k++);
		while (!s.empty() && arr1[k] > arr1[top]) {
			arr2[top] = arr1[k] - arr1[top];
			s.pop();
		}
		if (s.empty()) {
			s.push(k++);
		}
	}
}

void get_next(int* arr, int* next,int n) {

}

int main() {
	int n;
	cin >> n;
	int arr1[50] = { 0 }, arr2[50] = { 0 };
	for (int i = 0; i < n; i++)
		cin >> arr1[i];
	Temperature(arr1, arr2, n);
	for (int i = 0; i < n; i++) {
		cout << arr2[i] << " ";
	}
	return 0;
}